﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">

    <title>封装随机数函数</title>
    <style>
    </style>
    <script>
        function rnd(n, m) {
            return parseInt(Math.random() * (m - n) + n);   //获得n-m固定范围内的随机数
        }
        alert(rnd(1, 10));
    </script>
</head>

<body>
</body>
</html>
